<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>查询点菜单</title>
<link rel="stylesheet" type="text/css"
	href=${pageContext.servletContext.contextPath}/themes/default/easyui.css>
<link rel="stylesheet" type="text/css"
	href=${pageContext.servletContext.contextPath}/themes/icon.css>
<link rel="stylesheet" type="text/css"
	href=${pageContext.servletContext.contextPath}/themes/bootstrap/easyui.css>
<link rel="stylesheet" 
	href=${pageContext.servletContext.contextPath}/js/bootstrap.min.css>
<script type="text/javascript"
	src=${pageContext.servletContext.contextPath}/js/jquery.min.js></script>
<script type="text/javascript"
	src=${pageContext.servletContext.contextPath}/js/bootstrap.min.js></script>
<script type="text/javascript"
	src=${pageContext.servletContext.contextPath}/js/jquery.easyui.min.js></script>
<script type="text/javascript"
	src=${pageContext.servletContext.contextPath}/js/easyui-lang-zh_CN.js></script>
</head>
<script type="text/javascript">
$(function(){
	$('#msg').dialog('close');
	var id = 0;
	$('#dg').datagrid({    
		 url:'${pageContext.servletContext.contextPath}/loaddesk', 
		    pagination:true,
		    striped:true,
		    loadMsg:'正在加载',
		    pageSize:10,
			pageList:[5,10,15,20],
			columns : [ [ 
		  		   {field : 'cb',checkbox : true,width : 100,align : 'center',halign : 'center'
		  		}, {field : 'oid',title : '菜单号',width : 200,align : 'center',halign : 'center'
		  		}, {field : 'did',title : '桌号',width : 200,align : 'center',halign : 'center'
		  		}, {field : 'state',title : '审批状态',width : 200,align : 'center',halign : 'center'
		  		}, {field : 'ftime',title : '提交菜单时间',width : 200,align : 'center',halign : 'center'
		  		} ] ],
	  		toolbar : [{
	  			text : '查看菜单详情',
	  			iconCls : 'icon-search',
	  			width : 200,
	  			align : 'center',
	  			halign : 'center',
	  			handler : function() {
	  				var cks = $('#dg').datagrid('getSelections');
	  				if (cks.length == 1) {
	  					$.each(cks, function(i, n) {
	  						id = n.oid;
	  					})
	  					$.ajax({
	  						url:"${pageContext.servletContext.contextPath}/checkDeskH",
	  						dataType : "json",
	  						async : true,
	  						data : {
	  							"oid" : id
	  						},
	  						type : "post",
	  						success : function(r) {
	  							$("#oid").text(r.oid);
	  							$("#did").text(r.did);
	  							$("#foodname").text(r.foodname);
	  							$("#wname").text(r.wname);
	  							$("#state").text(r.state);
	  							$("#fnum").text(r.fnum);
	  							$("#ftime").text(r.ftime);
	  							$("#fprice").text(r.fprice);
	  						}
	  					})	
	  					$('#msg').dialog('open');
	  				} else {
	  					$.messager.alert('提示','请选择一行查看！', 'info');
	  				}
	  			}
	  		},'-',{
	  			text : '刷新菜单',
	  			iconCls : 'icon-reload',
	  			width : 200,
	  			align : 'center',
	  			halign : 'center',
	  			handler : function() {
	  				$('#dg').datagrid('reload');
	  			}
	  		}]
	  });
})
</script>
<body>
	<table id="dg"></table>  
	<div id="msg" class="easyui-dialog" title="菜单详情" style="width:600px;height:350px;"   
        data-options="iconCls:'icon-save',resizable:true,modal:true"> 
	<h4><span class="label label-default">菜单号：</span><span id="oid"></span></h4>
	<h4><span class="label label-default">桌号：</span><span id="did"></span></h4>
	<h4><span class="label label-default">菜名：</span><span id="foodname"></span></h4>
	<h4><span class="label label-default">点菜员：</span><span id="wname"></span></h4>
	<h4><span class="label label-default">审批状态：</span><span id="state"></span></h4>
	<h4><span class="label label-default">人数：</span><span id="fnum"></span></h4>
	<h4><span class="label label-default">提交时间：</span><span id="ftime"></span></h4>
	<h4><span class="label label-default">价格：</span><span id="fprice"></span></h4>
	</div>
</body>
</html>